const { defineConfig } = require('@vue/cli-service')
const pxtorem = require('postcss-pxtorem')

module.exports = defineConfig({
  transpileDependencies: true,
  css: {
    loaderOptions: {
      postcss: {
        postcssOptions: {
          plugins: [
            pxtorem({
              rootValue: 75,
              propList: ['*', '!font*'],
              selectorBlackList: ['van'],
            }),
          ],
        },
      },
    },
  },
  devServer: { // 配置 webpack-dev-server 服务器相关
    port: 8000,
    proxy: { // 反向代理
      '/zhangsan': {
        target: 'http://192.168.0.5:8080', // 代理的目标地址
      },
      '/lisi': {
        target: 'http://192.168.0.99:9283',
      },
      '/xiongmao': {
        target: 'http://www.xiongmaoyouxuan.com', // http://www.xiongmaoyouxuan.com/xiongmao/api/tabs
        changeOrigin: true, // 跨域
        pathRewrite: { // 路径更新
          '^/xiongmao': '',
        },
      },
      '/163': {
        target: 'https://music.163.com/store',
        changeOrigin: true,
        pathRewrite: {
          '^/163': '',
        },
      },
    },
  },
})
